package com.ppl.server.messages;

import java.util.Map;

/**
 * User: Vincent
 * Date: 11/13/12
 * Time: 3:11 PM
 */
public class UserLoginResponse extends Messages {
    private String identifier;
    private String firstnameOrFullname;
    private String lastname;
    private String sessionId;
    private Map<String, String> attributes;

    public String getIdentifier() {
        return identifier;
    }

    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }

    public String getFirstnameOrFullname() {
        return firstnameOrFullname;
    }

    public void setFirstnameOrFullname(String firstnameOrFullname) {
        this.firstnameOrFullname = firstnameOrFullname;
    }

    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    public Map<String, String> getAttributes() {
        return attributes;
    }

    public void setAttributes(Map<String, String> attributes) {
        this.attributes = attributes;
    }

    @Override
    public String toString() {
        return "UserLoginResponse{" +
                "identifier='" + identifier + '\'' +
                ", firstnameOrFullname='" + firstnameOrFullname + '\'' +
                ", lastname='" + lastname + '\'' +
                ", sessionId='" + sessionId + '\'' +
                ", attributes=" + attributes +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof UserLoginResponse)) return false;

        UserLoginResponse that = (UserLoginResponse) o;

        if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null) return false;
        if (firstnameOrFullname != null ? !firstnameOrFullname.equals(that.firstnameOrFullname) : that.firstnameOrFullname != null)
            return false;
        if (identifier != null ? !identifier.equals(that.identifier) : that.identifier != null) return false;
        if (lastname != null ? !lastname.equals(that.lastname) : that.lastname != null) return false;
        if (sessionId != null ? !sessionId.equals(that.sessionId) : that.sessionId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = identifier != null ? identifier.hashCode() : 0;
        result = 31 * result + (firstnameOrFullname != null ? firstnameOrFullname.hashCode() : 0);
        result = 31 * result + (lastname != null ? lastname.hashCode() : 0);
        result = 31 * result + (sessionId != null ? sessionId.hashCode() : 0);
        result = 31 * result + (attributes != null ? attributes.hashCode() : 0);
        return result;
    }
}
